Skip to content

Fix #438: Zero effective_amount_raised in cancel_campaign - #718

Open
meem08 wants to merge 2 commits into
Iris-IV:mainfrom
meem08:fix/438-cancel-campaign-zero-effective-amount
Open

Fix #438: Zero effective_amount_raised in cancel_campaign#718
meem08 wants to merge 2 commits into
Iris-IV:mainfrom
meem08:fix/438-cancel-campaign-zero-effective-amount

Conversation

@meem08

@meem08 meem08 commented Jul 30, 2026

Copy link
Copy Markdown

closes #438
closes #451

cancel_campaign (and admin_cancel_campaign) now set
campaign.effective_amount_raised = 0 to prevent stale values
from persisting on cancelled campaigns.

claim_refund is also guarded: the effective_amount_raised
deduction is skipped for cancelled campaigns, since the
value is already zeroed at cancel time and attempting to
subtract from zero would overflow.
@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@meem08 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@davidmaronio

Copy link
Copy Markdown
Contributor

this is the more complete of the two PRs for #438 (the other being #604). zeroing effective_amount_raised in both cancel_campaign and admin_cancel_campaign is the fix, and crucially you also guarded claim_refund (src/contributions.rs:281) with if !campaign.is_cancelled so post-cancel refunds don't drive the field negative. #604 misses that guard, so i'm inclined to take this one.

a few asks:

  1. PR body: it says "closes [Security] claim_creator_revenue: revenue pool depleted by precision loss silently under-pays last claimant #451" but nothing here touches the revenue claim path, that issue is being handled in Fix #451: creator absorbs remaining pool as final revenue claimant #723. please drop that line so [Security] claim_creator_revenue: revenue pool depleted by precision loss silently under-pays last claimant #451 doesn't auto-close on merge.
  2. src/campaigns/cancel.rs / src/contributions.rs: no tests. a regression test that cancels a funded campaign, asserts effective_amount_raised == 0, then claims a refund and asserts it stays 0 (and the refund succeeds) would lock in exactly the behavior this PR exists for.
  3. CI: the red checks are stale, fmt/clippy died on file for module found at both src/campaigns.rs and src/campaigns/mod.rs, which was the broken main from Feature/campaign tag filtering #618 that has since been fixed upstream. a rebase should make all three jobs green without any change on your side.

gate: git fetch upstream && git rebase upstream/main && git push --force-with-lease, add the regression test, and fix the PR body. once CI is green this is good to merge, and #604 can be closed as superseded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants